package view.prop;

import java.awt.Graphics;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

import model.prop.gem.Gem;
import view.View;
import view.entity.FloorView;

/**
 * TODO		宝石界面
 * @author	陈俊霖
 * @date	2018年5月15日
 * @time	上午11:01:37
 * @version	1.0
 */
public class GemVive extends JPanel implements View{

	
	private static final long serialVersionUID = -1387838913852989520L;

	private static final ImageIcon IMG = new ImageIcon("src\\model\\prop\\gem\\Gem.png");
	
	private int coord;
	
	public GemVive(int type) {
		if(type == Gem.GEM_TYPE_BLUE) {
			coord = 32;
		}
		setSize(48,48);
	}
	
	@Override
	public void show() {
		repaint();
	}


	@Override
	public void draw(Graphics g) {
		g.drawImage(IMG.getImage(), 0, 0, 48, 48, coord, 0, coord + 32, 32, null);
	}
	
	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		FloorView.FLOORVIEW.draw(g);
		draw(g);
	}

//	public static void main(String[] args) {
//		JFrame frame = new JFrame();
//		GemVive view = new GemVive(Gem.GEM_TYPE_RED);
//		frame.getContentPane().add(view);
//		frame.setVisible(true);
//		frame.setSize(200, 200);
//		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//		view.start();
//	}

}
